Trò chơi đua xe động vật trong UNITY Engine
114.785 lượt xem;
- InterpolationPow.cs
- Interpolations /
- Bapk /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3
4 public class InterpolationPow : InterpolationProcess {
5
6 protected int power;
7
8 public InterpolationPow(int power)
9 {
10 this.power = power;
11 }
12
13 public override float apply(float a)
14 {
15 if (a <= 0.5f) return Mathf.Pow(a * 2, power) / 2;
16 return Mathf.Pow((a - 1) * 2, power) / (power % 2 == 0 ? -2 : 2) + 1;
17 }
18 }
2 using System.Collections;
3
4 public class InterpolationPow : InterpolationProcess {
5
6 protected int power;
7
8 public InterpolationPow(int power)
9 {
10 this.power = power;
11 }
12
13 public override float apply(float a)
14 {
15 if (a <= 0.5f) return Mathf.Pow(a * 2, power) / 2;
16 return Mathf.Pow((a - 1) * 2, power) / (power % 2 == 0 ? -2 : 2) + 1;
17 }
18 }